package org.nepu.scr.indexrate.converter.riskrate.equipmentdata;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentdata.FixedWellMenu;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class FixedWellMenuConverter implements AttributeConverter<FixedWellMenu, String> {
    @Override
    public String convertToDatabaseColumn(FixedWellMenu fixedWellMenu) {
        return JSONUtil.toJsonStr(fixedWellMenu);
    }

    @Override
    public FixedWellMenu convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, FixedWellMenu.class);
    }
}
